<template>
	<div>
		<el-button type="primary" round style="float: left;" size="medium" @click="newEvent">新建</el-button>
		<tableList title="文章列表" ref="tableList"></tableList>
		<el-dialog title="新建文章" :visible.sync="dialogVisible" width="50%" center :close-on-click-modal="false">
			<Formvue ref="userFormref" title="文章列表" :dialogobj="dialogobj" @dialogVisibleemit="dialogVisibleemit">
			</Formvue>
		</el-dialog>
	</div>
</template>

<script>
	import tableList from "../../components/tableList.vue"
	import Formvue from "../../components/form.vue"
	import {
		mapState
	} from 'vuex'
	export default {
		name: 'articleList',
		data() {
			return {
				dialogVisible: false,
				dialogobj: {
					userid: "",
					name: "",
					description: "",
					pic: "",
					content: ""
				},
			}
		},
		components: {
			tableList,
			Formvue
		},
		computed: {
			...mapState(['userinfo'])
		},
		methods: {
			newEvent() {
				this.dialogobj = {
					userid: this.userinfo.id,
					name: "",
					description: "",
					pic: "",
					content: "",
					cate_id: ""
				}
				this.dialogVisible = true;
			},
			dialogVisibleemit() {
				this.dialogVisible = false;
				this.$refs.tableList.getTableData()
			}
		}
	}
</script>

<style lang="less" scoped>
</style>
